<div id = "runs">
  <table>
    <%if runs%>
      <tr>
        <td><%= sort_runs_by_tag "Run ID","run",problem,contest,user%></td>
        <% if !@user%>
          <td><%= sort_runs_by_tag "User","user",problem,contest,user%></td>
        <% end%>
        <% if !@contest%>
          <td> Contest:</td>
        <% end %>
        <% if !@problem%>
          <td><%= sort_runs_by_tag "Problem","problem",problem,contest,user%></td>
        <%end%>
        <td><%= sort_runs_by_tag "Language:","language",problem,contest,user%></td> 
        <td><%= sort_runs_by_tag "About:","about",problem,contest,user%></td>
        <td><%= sort_runs_by_tag "Time:","submit_time",problem,contest,user%></td>
      <td><%= sort_runs_by_tag "Status","status",problem,contest,user%></td></tr>
      <% runs.each do |run|%>
        <% if ok_status?(run.status) %>
          <tr class = "ok_submit">
        <% elsif judged_status?(run.status)%>
            <tr class = "wrong_submit">
          <% else %>
            <tr class = "unjudged_submit"> 
            <% end%>
            <%if admin? session[:user]%>
            <td><%= link_to run.run_id,:controller => :spoj1_admin,:action => :rejudge_run,:id => run%></td>
            <% else %>
            <td><%=run.run_id%></td>
            <% end%>
            <% if !@user%>
              <td> <%= link_to run.potrebitel.login,:action => :status,:user => run.potrebitel.id,:problem => problem , 
              :contest => contest,:order => order%></td>
      <% end%>
      <%if !@contest%>
              <td> <%= link_to run.problem.contest.name, :action => :status,:contest => run.problem.contest,:user => user,:order => order%></td>
            <% end%>
            <% if !@problem%>
              <td> <%= link_to run.problem.name,:action => :status,:problem => run.problem, :user => user,:order => order%></td>
            <% end%>
            <td><%= link_to run.language,:controller => :runs,:action => :show,:id => run.run_id%></td>
            <td><%= run.about%></td>
            <td><%= printable_time run.submit_time%></td>
            <td>
              <% if judged_status? run.status%>
                        <% unless compile_error_status? run.status%>
                              <%=run.status%>
                        <% else %>
                                  <%= link_to run.status,:action => :show_log, :run => run%>
                        <%end%>
               <% else%>
                        <%= run.status%>
                   <%end%>
            </td>
          </tr>
        <%end%>
  <%else%>
        No runs found!!!
      <%end%>
    </table>
  </div>
